package com.itany.netclass.util;

/**
 * Author:sjy@itany.com
 * Date:2021/9/16 16:25
 * Version:1.0-SNAPSHOT
 */
public class ParameterUtil {

    public static boolean isNull(String s){
        if(null == s || "".equals(s)){
            return true;
        }
        return false;
    }

    public static String nextValue(String s){
        int i = Integer.parseInt(s)+1;
        s = "00000"+i;
        return s.substring(s.length()-6);
    }

    public static String fileSizeToMB(long fileSize) {
        String MB = "";
        int m = (int) ((fileSize / 1024) / 1024);
        int k = (int) ((fileSize / 1024) % 1024);
        if (k == 0) {
            return m != 0 ? m + "MB" : "0KB";
        } else {
            return m != 0 ? m + "MB." + k + " KB" : k + "KB";
        }
    }

}
